31. DELETE

DELETE

Question:

Start Quiz:

Solution:

Solution

DELETE FROM pets WHERE _id = 4;


Explanation

The general syntax to remove a record from a table is
DELETE FROM table_name WHERE condition

DELETE FROM table_name

DELETE FROM are the keywords indicating we want to remove something from the specified table, here indicated as table_name.

WHERE condition

The WHERE clause narrows which record from the table we want to remove. In this case, Lady is in the row with _id = 4, which is what we set the condition to be.

INSTRUCTOR NOTE:


The SQL/SQLite Commands Cheat Sheet can be accessed here. It is also available from the Resources Tab.